package com.timesheet.serverice;

import java.util.Calendar;
import java.util.List;

import com.timesheet.server.common.models.AssignTaskEmployeeDTO;
import com.timesheet.server.common.models.CAssignTaskEmployeePk;
import com.timesheet.server.common.models.TaskDTO;
import com.timesheet.server.common.session.Session;
import com.timesheet.server.dao.TaskDao;


public class TaskService {
	TaskDao taskDao = new TaskDao();
	
	
	public static void main(String[] args) {
		TaskService TaskService = new TaskService();
		//TaskService.createTask();
		TaskService.assignTAsk2Emp();
		/*List allAssignedTasks = TaskService.getAllAssignedTasks(new Long("51"));
		System.out.println("allAssignedTasks: "+allAssignedTasks);*/

		
		

	}
	
	public boolean assignTAsk2Emp(){
		
		AssignTaskEmployeeDTO cTaskEmployee = new AssignTaskEmployeeDTO();
		
		CAssignTaskEmployeePk assignTaskEmployeePk = new CAssignTaskEmployeePk();
		
		assignTaskEmployeePk.setEmployeeId("1003");
		assignTaskEmployeePk.setTaskId("100");
		
		cTaskEmployee.setAssignTaskEmployeePk(assignTaskEmployeePk );
		return taskDao.assignTask2Emploee(cTaskEmployee);
	}
	
	public boolean createTask(TaskDTO dto){
		return taskDao.createTask(dto);
	}
	
	public boolean createTask(){
		
		TaskDTO task = new TaskDTO();
		task.setTaskName("Sample");
		
		task.setCreatedBy(Session.INSTANCE.getUser());
		task.setCreationDate(Calendar.getInstance().getTime());
		task.setTaskId("100");
		task.setTaskNo("100");
		task.setTaskStatus("Open");
		
		
		return taskDao.createTask(task);
	}
	
	public List<TaskDTO> getTasks(){
		return taskDao.getTasks();
	}
	
	public List getAllAssignedTasks(Long empId){
		return taskDao.getAssignedTask(empId);
	}

}
